package com.gt.mapper;

import com.github.pagehelper.Page;
import com.gt.pojo.dto.CategoryPageQueryDTO;
import com.gt.pojo.entity.Category;
import com.gt.pojo.vo.CategoryListVO;
import com.gt.pojo.vo.CategoryVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {



    @Insert("insert into library.category(name, create_time, update_time, create_user, update_user)" +
            " VALUES (#{name},#{createTime}, #{updateTime}, #{createUser}, #{updateUser})")
    void insert(Category category);

    Page<CategoryVO> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);

    /**
     * 根据id删除分类
     * @param id
     */
    @Delete("delete from library.category where id = #{id}")
    void deleteById(Long id);

    void update(Category category);


    List<CategoryListVO> getCategoryName();
}
